/*********************************************************************
	Rhapsody	: 7.5.2
	Login		: Administrator
	Component	: Test
	Configuration 	: DefaultConfig
	Model Element	: RobotController
//!	Generated Date	: Wed, 1, Dec 2010 
	File Path	: Test/DefaultConfig/RobotPkg/RobotController.java
*********************************************************************/

package RobotPkg;

//## auto_generated
import java.util.*;
//## auto_generated
import com.ibm.rational.rhapsody.oxf.*;
//## auto_generated
import com.ibm.rational.rhapsody.animation.*;
//## auto_generated
import com.ibm.rational.rhapsody.oxf.states.*;
//## auto_generated
import com.ibm.rational.rhapsody.animcom.animMessages.*;

//----------------------------------------------------------------------------
// RobotPkg/RobotController.java                                                                  
//----------------------------------------------------------------------------

//## package RobotPkg 


//## class RobotController 
public class RobotController implements RiJStateConcept, Animated {
    
    public Reactive reactive;		//## ignore 
    
    protected ArrayList<Engine> itsEngine;		//## classInstance itsEngine 
    
    protected Engine itsEngine_1;		//## link itsEngine_1 
    
    protected ArrayList<IEngine> itsIEngine;		//## link itsIEngine 
    
    protected ArrayList<ISensor> itsISensor;		//## link itsISensor 
    
    protected ArrayList<Sensor> itsSensor;		//## classInstance itsSensor 
    
    protected Sensor itsSensor_1;		//## link itsSensor_1 
    
    //#[ ignore 
    public static final int RiJNonState=0;
    public static final int on=1;
    public static final int state_6=2;
    public static final int detecing=3;
    public static final int state_5=4;
    public static final int stable=5;
    public static final int processing=6;
    public static final int off=7;
    //#]
    protected int rootState_subState;		//## ignore 
    
    protected int rootState_active;		//## ignore 
    
    protected int state_6_subState;		//## ignore 
    
    protected int state_6_active;		//## ignore 
    
    protected int state_5_subState;		//## ignore 
    
    protected int state_5_active;		//## ignore 
    
    //#[ ignore
    // Instrumentation attributes (Animation)
    private Animate animate;
    
    public static AnimClass animClassRobotController = new AnimClass("RobotPkg.RobotController",false);
    //#]
    
    
    //## statechart_method 
    public RiJThread getThread() {
        return reactive.getThread();
    }
    
    //## statechart_method 
    public void schedTimeout(long delay, long tmID, RiJStateReactive reactive) {
        getThread().schedTimeout(delay, tmID, reactive);
    }
    
    //## statechart_method 
    public void unschedTimeout(long tmID, RiJStateReactive reactive) {
        getThread().unschedTimeout(tmID, reactive);
    }
    
    //## statechart_method 
    public boolean isIn(int state) {
        return reactive.isIn(state);
    }
    
    //## statechart_method 
    public boolean isCompleted(int state) {
        return reactive.isCompleted(state);
    }
    
    //## statechart_method 
    public RiJEventConsumer getEventConsumer() {
        return (RiJEventConsumer)reactive;
    }
    
    //## statechart_method 
    public void gen(RiJEvent event) {
        reactive._gen(event);
    }
    
    //## statechart_method 
    public void queueEvent(RiJEvent event) {
        reactive.queueEvent(event);
    }
    
    //## statechart_method 
    public int takeEvent(RiJEvent event) {
        return reactive.takeEvent(event);
    }
    
    // Constructors
    
    //## auto_generated 
    public  RobotController(RiJThread p_thread) {
        try {
            animInstance().notifyConstructorEntered(animClassRobotController.getUserClass(),
               new ArgData[] {
               });
        
        reactive = new Reactive(p_thread);
        {
            itsEngine = new ArrayList<Engine>();
        }
        {
            itsIEngine = new ArrayList<IEngine>();
        }
        {
            itsISensor = new ArrayList<ISensor>();
        }
        {
            itsSensor = new ArrayList<Sensor>();
        }
        initRelations(p_thread);
        }
        finally {
            animInstance().notifyMethodExit();
        }
        
    }
    
    //## operation process() 
    public void process() {
        try {
            animInstance().notifyMethodEntered("process",
               new ArgData[] {
               });
        
        //#[ operation process() 
        //#]
        }
        finally {
            animInstance().notifyMethodExit();
        }
        
    }
    
    //## auto_generated 
    public ListIterator<Engine> getItsEngine() {
        ListIterator<Engine> iter = itsEngine.listIterator();
        return iter;
    }
    
    //## auto_generated 
    public Engine newItsEngine() {
        Engine newEngine = new Engine();
        itsEngine.add(newEngine);
        animInstance().notifyRelationAdded("itsEngine", newEngine);
        return newEngine;
    }
    
    //## auto_generated 
    public void deleteItsEngine(Engine p_Engine) {
        itsEngine.remove(p_Engine);
        animInstance().notifyRelationRemoved("itsEngine", p_Engine);
        p_Engine=null;
    }
    
    //## auto_generated 
    public Engine getItsEngine_1() {
        return itsEngine_1;
    }
    
    //## auto_generated 
    public void __setItsEngine_1(Engine p_Engine) {
        itsEngine_1 = p_Engine;
        if(p_Engine != null)
            {
                animInstance().notifyRelationAdded("itsEngine_1", p_Engine);
            }
        else
            {
                animInstance().notifyRelationCleared("itsEngine_1");
            }
    }
    
    //## auto_generated 
    public void _setItsEngine_1(Engine p_Engine) {
        if(itsEngine_1 != null)
            {
                itsEngine_1._removeItsRobotController(this);
            }
        __setItsEngine_1(p_Engine);
    }
    
    //## auto_generated 
    public void setItsEngine_1(Engine p_Engine) {
        if(p_Engine != null)
            {
                p_Engine._addItsRobotController(this);
            }
        _setItsEngine_1(p_Engine);
    }
    
    //## auto_generated 
    public void _clearItsEngine_1() {
        animInstance().notifyRelationCleared("itsEngine_1");
        itsEngine_1 = null;
    }
    
    //## auto_generated 
    public ListIterator<IEngine> getItsIEngine() {
        ListIterator<IEngine> iter = itsIEngine.listIterator();
        return iter;
    }
    
    //## auto_generated 
    public void addItsIEngine(IEngine p_IEngine) {
        if(p_IEngine != null)
            {
                animInstance().notifyRelationAdded("itsIEngine", p_IEngine);
            }
        else
            {
                animInstance().notifyRelationCleared("itsIEngine");
            }
        itsIEngine.add(0, p_IEngine);
    }
    
    //## auto_generated 
    public void removeItsIEngine(IEngine p_IEngine) {
        animInstance().notifyRelationRemoved("itsIEngine", p_IEngine);
        itsIEngine.remove(p_IEngine);
    }
    
    //## auto_generated 
    public void clearItsIEngine() {
        animInstance().notifyRelationCleared("itsIEngine");
        itsIEngine.clear();
    }
    
    //## auto_generated 
    public ListIterator<ISensor> getItsISensor() {
        ListIterator<ISensor> iter = itsISensor.listIterator();
        return iter;
    }
    
    //## auto_generated 
    public void addItsISensor(ISensor p_ISensor) {
        if(p_ISensor != null)
            {
                animInstance().notifyRelationAdded("itsISensor", p_ISensor);
            }
        else
            {
                animInstance().notifyRelationCleared("itsISensor");
            }
        itsISensor.add(0, p_ISensor);
    }
    
    //## auto_generated 
    public void removeItsISensor(ISensor p_ISensor) {
        animInstance().notifyRelationRemoved("itsISensor", p_ISensor);
        itsISensor.remove(p_ISensor);
    }
    
    //## auto_generated 
    public void clearItsISensor() {
        animInstance().notifyRelationCleared("itsISensor");
        itsISensor.clear();
    }
    
    //## auto_generated 
    public ListIterator<Sensor> getItsSensor() {
        ListIterator<Sensor> iter = itsSensor.listIterator();
        return iter;
    }
    
    //## auto_generated 
    public Sensor newItsSensor() {
        Sensor newSensor = new Sensor();
        itsSensor.add(newSensor);
        animInstance().notifyRelationAdded("itsSensor", newSensor);
        return newSensor;
    }
    
    //## auto_generated 
    public void deleteItsSensor(Sensor p_Sensor) {
        itsSensor.remove(p_Sensor);
        animInstance().notifyRelationRemoved("itsSensor", p_Sensor);
        p_Sensor=null;
    }
    
    //## auto_generated 
    public Sensor getItsSensor_1() {
        return itsSensor_1;
    }
    
    //## auto_generated 
    public void __setItsSensor_1(Sensor p_Sensor) {
        itsSensor_1 = p_Sensor;
        if(p_Sensor != null)
            {
                animInstance().notifyRelationAdded("itsSensor_1", p_Sensor);
            }
        else
            {
                animInstance().notifyRelationCleared("itsSensor_1");
            }
    }
    
    //## auto_generated 
    public void _setItsSensor_1(Sensor p_Sensor) {
        if(itsSensor_1 != null)
            {
                itsSensor_1._removeItsRobotController(this);
            }
        __setItsSensor_1(p_Sensor);
    }
    
    //## auto_generated 
    public void setItsSensor_1(Sensor p_Sensor) {
        if(p_Sensor != null)
            {
                p_Sensor._addItsRobotController(this);
            }
        _setItsSensor_1(p_Sensor);
    }
    
    //## auto_generated 
    public void _clearItsSensor_1() {
        animInstance().notifyRelationCleared("itsSensor_1");
        itsSensor_1 = null;
    }
    
    //## auto_generated 
    protected void initRelations(RiJThread p_thread) {
        {
            for (int i = 0; i < 4; i++) 
                newItsEngine();
            
        }
        {
            for (int i = 0; i < 6; i++) 
                newItsSensor();
            
        }
    }
    
    //## auto_generated 
    public boolean startBehavior() {
        boolean done = true;
        done &= reactive.startBehavior();
        return done;
    }
    
    //## ignore 
    public class Reactive extends RiJStateReactive implements AnimatedReactive {
        
        // Default constructor 
        public Reactive() {
            this(RiJMainThread.instance());
        }
        
        
        // Constructors
        
        public  Reactive(RiJThread p_thread) {
            super(p_thread);
            initStatechart();
        }
        
        //## statechart_method 
        public boolean isIn(int state) {
            if(state_5 == state)
                {
                    return isIn(on);
                }
            if(state_5_subState == state)
                {
                    return true;
                }
            if(state_6 == state)
                {
                    return isIn(on);
                }
            if(state_6_subState == state)
                {
                    return true;
                }
            if(rootState_subState == state)
                {
                    return true;
                }
            return false;
        }
        
        //## statechart_method 
        public boolean isCompleted(int state) {
            return true;
        }
        
        //## statechart_method 
        public void rootState_add(AnimStates animStates) {
            animStates.add("ROOT");
            switch (rootState_subState) {
                case off:
                {
                    off_add(animStates);
                }
                break;
                case on:
                {
                    on_add(animStates);
                }
                break;
                default:
                    break;
            }
        }
        
        //## statechart_method 
        public void rootState_entDef() {
            {
                rootState_enter();
                rootStateEntDef();
            }
        }
        
        //## statechart_method 
        public int rootState_dispatchEvent(short id) {
            int res = RiJStateReactive.TAKE_EVENT_NOT_CONSUMED;
            switch (rootState_active) {
                case off:
                {
                    res = off_takeEvent(id);
                }
                break;
                case on:
                {
                    res = on_dispatchEvent(id);
                }
                break;
                default:
                    break;
            }
            return res;
        }
        
        //## statechart_method 
        public void on_add(AnimStates animStates) {
            animStates.add("ROOT.on");
            state_5_add(animStates);
            state_6_add(animStates);
        }
        
        //## statechart_method 
        public int on_dispatchEvent(short id) {
            int res = RiJStateReactive.TAKE_EVENT_NOT_CONSUMED;
            if(state_5_dispatchEvent(id) >= 0)
                {
                    res = RiJStateReactive.TAKE_EVENT_COMPLETE;
                    if(!isIn(on))
                        {
                            return res;
                        }
                }
            if(state_6_dispatchEvent(id) >= 0)
                {
                    res = RiJStateReactive.TAKE_EVENT_COMPLETE;
                    if(!isIn(on))
                        {
                            return res;
                        }
                }
            if(res == RiJStateReactive.TAKE_EVENT_NOT_CONSUMED)
                {
                    res = on_takeEvent(id);
                }
            return res;
        }
        
        //## statechart_method 
        public void state_6_add(AnimStates animStates) {
            animStates.add("ROOT.on.state_6");
            if(state_6_subState == detecing)
                {
                    detecing_add(animStates);
                }
        }
        
        //## statechart_method 
        public int state_6_dispatchEvent(short id) {
            int res = RiJStateReactive.TAKE_EVENT_NOT_CONSUMED;
            if(state_6_active == detecing)
                {
                    res = detecing_takeEvent(id);
                }
            return res;
        }
        
        //## statechart_method 
        public void detecing_add(AnimStates animStates) {
            animStates.add("ROOT.on.state_6.detecing");
        }
        
        //## statechart_method 
        public void state_5_add(AnimStates animStates) {
            animStates.add("ROOT.on.state_5");
            switch (state_5_subState) {
                case stable:
                {
                    stable_add(animStates);
                }
                break;
                case processing:
                {
                    processing_add(animStates);
                }
                break;
                default:
                    break;
            }
        }
        
        //## statechart_method 
        public int state_5_dispatchEvent(short id) {
            int res = RiJStateReactive.TAKE_EVENT_NOT_CONSUMED;
            switch (state_5_active) {
                case stable:
                {
                    res = stable_takeEvent(id);
                }
                break;
                case processing:
                {
                    res = processing_takeEvent(id);
                }
                break;
                default:
                    break;
            }
            return res;
        }
        
        //## statechart_method 
        public void stable_add(AnimStates animStates) {
            animStates.add("ROOT.on.state_5.stable");
        }
        
        //## statechart_method 
        public void processing_add(AnimStates animStates) {
            animStates.add("ROOT.on.state_5.processing");
        }
        
        //## statechart_method 
        public void off_add(AnimStates animStates) {
            animStates.add("ROOT.off");
        }
        
        //## auto_generated 
        protected void initStatechart() {
            rootState_subState = RiJNonState;
            rootState_active = RiJNonState;
            state_6_subState = RiJNonState;
            state_6_active = RiJNonState;
            state_5_subState = RiJNonState;
            state_5_active = RiJNonState;
        }
        
        //## statechart_method 
        public void offEnter() {
        }
        
        //## statechart_method 
        public void detecingEnter() {
            //#[ state ROOT.on.state_6.detecing.(Entry) 
            System.out.println("Detecting ...");
            //#]
        }
        
        //## statechart_method 
        public int processingTakeNull() {
            int res = RiJStateReactive.TAKE_EVENT_NOT_CONSUMED;
            animInstance().notifyTransitionStarted("4");
            processing_exit();
            stable_entDef();
            animInstance().notifyTransitionEnded("4");
            res = RiJStateReactive.TAKE_EVENT_COMPLETE;
            return res;
        }
        
        //## statechart_method 
        public void stableExit() {
        }
        
        //## statechart_method 
        public void state_5EntDef() {
            animInstance().notifyTransitionStarted("2");
            stable_entDef();
            animInstance().notifyTransitionEnded("2");
        }
        
        //## statechart_method 
        public void detecing_enter() {
            animInstance().notifyStateEntered("ROOT.on.state_6.detecing");
            state_6_subState = detecing;
            state_6_active = detecing;
            detecingEnter();
        }
        
        //## statechart_method 
        public void state_6_entDef() {
            state_6_enter();
            state_6EntDef();
        }
        
        //## statechart_method 
        public void processingEnter() {
            //#[ state ROOT.on.state_5.processing.(Entry) 
            System.out.println("Begin processing");
            //#]
        }
        
        //## statechart_method 
        public void state_6EntDef() {
            animInstance().notifyTransitionStarted("5");
            detecing_entDef();
            animInstance().notifyTransitionEnded("5");
        }
        
        //## statechart_method 
        public void off_exit() {
            offExit();
            animInstance().notifyStateExited("ROOT.off");
        }
        
        //## statechart_method 
        public void offExit() {
        }
        
        //## statechart_method 
        public void detecing_exit() {
            detecingExit();
            animInstance().notifyStateExited("ROOT.on.state_6.detecing");
        }
        
        //## statechart_method 
        public int state_6_takeEvent(short id) {
            int res = RiJStateReactive.TAKE_EVENT_NOT_CONSUMED;
            return res;
        }
        
        //## statechart_method 
        public int stableTakeevProcess() {
            int res = RiJStateReactive.TAKE_EVENT_NOT_CONSUMED;
            animInstance().notifyTransitionStarted("3");
            stable_exit();
            //#[ transition 3 
            System.out.println("Event process");
            process();
            //#]
            processing_entDef();
            animInstance().notifyTransitionEnded("3");
            res = RiJStateReactive.TAKE_EVENT_COMPLETE;
            return res;
        }
        
        //## statechart_method 
        public void onEnter() {
        }
        
        //## statechart_method 
        public void processing_exit() {
            popNullConfig();
            processingExit();
            animInstance().notifyStateExited("ROOT.on.state_5.processing");
        }
        
        //## statechart_method 
        public void processingExit() {
            //#[ state ROOT.on.state_5.processing.(Exit) 
            System.out.println("End processing");
            //#]
        }
        
        //## statechart_method 
        public void stable_entDef() {
            stable_enter();
        }
        
        //## statechart_method 
        public int detecingTakeevLine() {
            evLine params = (evLine) event;
            int res = RiJStateReactive.TAKE_EVENT_NOT_CONSUMED;
            animInstance().notifyTransitionStarted("6");
            on_exit();
            //#[ transition 6 
            System.out.println("event line from sensor = "+params.sensorId+" value = "+params.line);
            System.out.println(itsSensor);
            //itsSensor[sensorId].setLine(params.line);
            gen(new evProcess());
            //#]
            on_enter();
            state_6_entDef();
            state_5_enter();
            stable_entDef();
            animInstance().notifyTransitionEnded("6");
            res = RiJStateReactive.TAKE_EVENT_COMPLETE;
            return res;
        }
        
        //## statechart_method 
        public int rootState_takeEvent(short id) {
            int res = RiJStateReactive.TAKE_EVENT_NOT_CONSUMED;
            return res;
        }
        
        //## statechart_method 
        public void on_exit() {
            state_5_exit();
            state_6_exit();
            onExit();
            animInstance().notifyStateExited("ROOT.on");
        }
        
        //## statechart_method 
        public void on_entDef() {
            on_enter();
            state_5_entDef();
            state_6_entDef();
        }
        
        //## statechart_method 
        public int state_5_takeEvent(short id) {
            int res = RiJStateReactive.TAKE_EVENT_NOT_CONSUMED;
            return res;
        }
        
        //## statechart_method 
        public int on_takeEvent(short id) {
            int res = RiJStateReactive.TAKE_EVENT_NOT_CONSUMED;
            if(event.isTypeOf(evOnOff.evOnOff_RobotPkg_id))
                {
                    res = onTakeevOnOff();
                }
            
            return res;
        }
        
        //## statechart_method 
        public void rootState_enter() {
            animInstance().notifyStateEntered("ROOT");
            rootStateEnter();
        }
        
        //## statechart_method 
        public void rootStateEnter() {
        }
        
        //## statechart_method 
        public int offTakeevOnOff() {
            int res = RiJStateReactive.TAKE_EVENT_NOT_CONSUMED;
            animInstance().notifyTransitionStarted("1");
            off_exit();
            //#[ transition 1 
            System.out.println("Robot On");
            //#]
            on_entDef();
            animInstance().notifyTransitionEnded("1");
            res = RiJStateReactive.TAKE_EVENT_COMPLETE;
            return res;
        }
        
        //## statechart_method 
        public void off_enter() {
            animInstance().notifyStateEntered("ROOT.off");
            rootState_subState = off;
            rootState_active = off;
            offEnter();
        }
        
        //## statechart_method 
        public int stable_takeEvent(short id) {
            int res = RiJStateReactive.TAKE_EVENT_NOT_CONSUMED;
            if(event.isTypeOf(evProcess.evProcess_RobotPkg_id))
                {
                    res = stableTakeevProcess();
                }
            
            if(res == RiJStateReactive.TAKE_EVENT_NOT_CONSUMED)
                {
                    res = state_5_takeEvent(id);
                }
            return res;
        }
        
        //## statechart_method 
        public void onExit() {
        }
        
        //## statechart_method 
        public int processing_takeEvent(short id) {
            int res = RiJStateReactive.TAKE_EVENT_NOT_CONSUMED;
            if(event.isTypeOf(RiJEvent.NULL_EVENT_ID))
                {
                    res = processingTakeNull();
                }
            
            if(res == RiJStateReactive.TAKE_EVENT_NOT_CONSUMED)
                {
                    res = state_5_takeEvent(id);
                }
            return res;
        }
        
        //## statechart_method 
        public void stable_enter() {
            animInstance().notifyStateEntered("ROOT.on.state_5.stable");
            state_5_subState = stable;
            state_5_active = stable;
            stableEnter();
        }
        
        //## statechart_method 
        public void stableEnter() {
        }
        
        //## statechart_method 
        public void on_enter() {
            animInstance().notifyStateEntered("ROOT.on");
            rootState_subState = on;
            rootState_active = on;
            onEnter();
        }
        
        //## statechart_method 
        public void rootState_exit() {
            switch (rootState_subState) {
                case off:
                {
                    off_exit();
                }
                break;
                case on:
                {
                    on_exit();
                }
                break;
                default:
                    break;
            }
            rootState_subState = RiJNonState;
            rootStateExit();
            animInstance().notifyStateExited("ROOT");
        }
        
        //## statechart_method 
        public void rootStateEntDef() {
            animInstance().notifyTransitionStarted("0");
            off_entDef();
            animInstance().notifyTransitionEnded("0");
        }
        
        //## statechart_method 
        public int off_takeEvent(short id) {
            int res = RiJStateReactive.TAKE_EVENT_NOT_CONSUMED;
            if(event.isTypeOf(evOnOff.evOnOff_RobotPkg_id))
                {
                    res = offTakeevOnOff();
                }
            
            return res;
        }
        
        //## statechart_method 
        public void state_5Exit() {
        }
        
        //## statechart_method 
        public void state_5_entDef() {
            state_5_enter();
            state_5EntDef();
        }
        
        //## statechart_method 
        public int detecing_takeEvent(short id) {
            int res = RiJStateReactive.TAKE_EVENT_NOT_CONSUMED;
            if(event.isTypeOf(evLine.evLine_RobotPkg_id))
                {
                    res = detecingTakeevLine();
                }
            
            if(res == RiJStateReactive.TAKE_EVENT_NOT_CONSUMED)
                {
                    res = state_6_takeEvent(id);
                }
            return res;
        }
        
        //## statechart_method 
        public void state_6Enter() {
        }
        
        //## statechart_method 
        public void processing_entDef() {
            processing_enter();
        }
        
        //## statechart_method 
        public void state_5Enter() {
        }
        
        //## statechart_method 
        public void state_6Exit() {
        }
        
        //## statechart_method 
        public int onTakeevOnOff() {
            int res = RiJStateReactive.TAKE_EVENT_NOT_CONSUMED;
            animInstance().notifyTransitionStarted("7");
            on_exit();
            //#[ transition 7 
            System.out.println("Robot Off");
            //#]
            off_entDef();
            animInstance().notifyTransitionEnded("7");
            res = RiJStateReactive.TAKE_EVENT_COMPLETE;
            return res;
        }
        
        //## statechart_method 
        public void stable_exit() {
            stableExit();
            animInstance().notifyStateExited("ROOT.on.state_5.stable");
        }
        
        //## statechart_method 
        public void rootStateExit() {
        }
        
        //## statechart_method 
        public void processing_enter() {
            animInstance().notifyStateEntered("ROOT.on.state_5.processing");
            pushNullConfig();
            state_5_subState = processing;
            state_5_active = processing;
            processingEnter();
        }
        
        //## statechart_method 
        public void state_5_enter() {
            animInstance().notifyStateEntered("ROOT.on.state_5");
            state_5Enter();
        }
        
        //## statechart_method 
        public void detecingExit() {
            //#[ state ROOT.on.state_6.detecing.(Exit) 
            System.out.println("Something detected");
            //#]
        }
        
        //## statechart_method 
        public void detecing_entDef() {
            detecing_enter();
        }
        
        //## statechart_method 
        public void state_6_exit() {
            if(state_6_subState == detecing)
                {
                    detecing_exit();
                }
            state_6_subState = RiJNonState;
            state_6Exit();
            animInstance().notifyStateExited("ROOT.on.state_6");
        }
        
        //## statechart_method 
        public void off_entDef() {
            off_enter();
        }
        
        //## statechart_method 
        public void state_5_exit() {
            switch (state_5_subState) {
                case stable:
                {
                    stable_exit();
                }
                break;
                case processing:
                {
                    processing_exit();
                }
                break;
                default:
                    break;
            }
            state_5_subState = RiJNonState;
            state_5Exit();
            animInstance().notifyStateExited("ROOT.on.state_5");
        }
        
        //## statechart_method 
        public void state_6_enter() {
            animInstance().notifyStateEntered("ROOT.on.state_6");
            state_6Enter();
        }
        
        /**  methods added just for design level debugging instrumentation */
        public boolean startBehavior() {
            try {
              animInstance().notifyBehavioralMethodEntered("startBehavior",
                  new ArgData[] {
                   });
              return super.startBehavior();
            }
            finally {
              animInstance().notifyMethodExit();
            }
        }
        public int takeEvent(RiJEvent event) { 
            try { 
              //animInstance().notifyTakeEvent(new AnimEvent(event));
              animInstance().notifyBehavioralMethodEntered("takeEvent",
                  new ArgData[] { new ArgData(RiJEvent.class, "event", event.toString())
                   });
              return super.takeEvent(event); 
            }
            finally { 
              animInstance().notifyMethodExit();
            }
        }
        /**  see com.ibm.rational.rhapsody.animation.AnimatedReactive interface */
        public AnimInstance animInstance() { 
            return RobotController.this.animInstance(); 
        }
        
    }
    //#[ ignore
    /**  see com.ibm.rational.rhapsody.animation.Animated interface */
    public AnimClass getAnimClass() { 
        return animClassRobotController; 
    }
    /**  see com.ibm.rational.rhapsody.animation.Animated interface */
    public Object getFieldValue(java.lang.reflect.Field f, Object userInstance) { 
         Object obj = null;
         try {
             obj = f.get(userInstance);
         } catch(Exception e) {
              System.err.println("Exception: getting Field value: " + e);
              e.printStackTrace();
         }
         return obj;
    }
    /**  see com.ibm.rational.rhapsody.animation.Animated interface */
    public AnimInstance animInstance() {
        if (animate == null) 
            animate = new Animate(); 
        return animate; 
    } 
    /**  see com.ibm.rational.rhapsody.animation.Animated interface */
    public void addAttributes(AnimAttributes msg) {
        
    }
    /**  see com.ibm.rational.rhapsody.animation.Animated interface */
    public void addRelations(AnimRelations msg) {
        
        msg.add("itsSensor", true, false, itsSensor);
        msg.add("itsEngine", true, false, itsEngine);
        msg.add("itsSensor_1", false, true, itsSensor_1);
        msg.add("itsEngine_1", false, true, itsEngine_1);
        msg.add("itsIEngine", false, false, itsIEngine);
        msg.add("itsISensor", false, false, itsISensor);
    }
    /** An inner class added as instrumentation for animation */
    public class Animate extends AnimInstance { 
        public  Animate() { 
            super(RobotController.this); 
        } 
        public void addAttributes(AnimAttributes msg) {
            RobotController.this.addAttributes(msg);
        }
        public void addRelations(AnimRelations msg) {
            RobotController.this.addRelations(msg);
        }
        
        public void addStates(AnimStates msg) {
            if ((reactive != null) && (reactive.isTerminated() == false))
              reactive.rootState_add(msg);
        }
        
    } 
    //#]
    
}
/*********************************************************************
	File Path	: Test/DefaultConfig/RobotPkg/RobotController.java
*********************************************************************/

